home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 27 / CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso / CUCD / Programming / THXPlayLib / src / interrupt.asm < prev    next >
Encoding:
Assembly Source File  |  1998-05-10  |  1.9 KB  |  92 lines

  1. ; thxplay: The interrupt code called by the CIA or VSYNC interrupt
  2.  
  3. ; interrupt structure
  4. int    dc.l    0,0        ; ln_succ, ln_pred
  5.     dc.b    NT_INTERRUPT,-1    ; ln_type, ln_pri
  6.     dc.l    intname        ; ln_name
  7.     dc.l    0        ; iv_data
  8.     dc.l    intcode        ; iv_code
  9.  
  10. intname    dc.b    "Nora Batty's original THX2 player (tm)",0
  11.     cnop    0,4
  12.  
  13. ;-----------------------------------------------------------------------------
  14.  
  15. intcode    movem.l    d0-d7/a0-a6,-(sp)
  16.  
  17. ; main playroutine (see play.asm)
  18.  
  19.     move.l    THX+thxBSS_P(pc),a0
  20.     tst.b    thx_pPlaying(a0)
  21.     beq.s    .exit            ; skip if not playing
  22.     bsr.s    THX+thxInterrupt    ; play one frame of music
  23.  
  24.  
  25. ; thxSignalEnd() support (see misc.asm)
  26.  
  27.     tst.b    thx_pSongEnd(a0)
  28.     beq.s    .sig_end        ; skip if not songend
  29.     move.w    dosig(pc),d0
  30.     beq.s    .sig_end        ; skip if trigger unset
  31.     move.l    4.w,a6
  32.     move.l    task(pc),a1
  33.     move.l    signals(pc),d0
  34.     jsr    _LVOSignal(a6)        ; Signal(task, signals)
  35.     lea    dosig(pc),a0
  36.     clr.w    (a0)            ; reset trigger
  37. .sig_end
  38.  
  39. ; bangnote support (see note.asm)
  40.     lea    chan0(pc),a0
  41.     move.b    (a0)+,d0        ; test bn_on of channel 0
  42.     beq.s    .no0
  43.     moveq    #0,d4
  44.     bsr.s    _playnote        ; if on, play note on channel 0
  45. .no0    lea    chan1(pc),a0
  46.     move.b    (a0)+,d0        ; test bn_on of channel 1
  47.     beq.s    .no1
  48.     moveq    #1,d4
  49.     bsr.s    _playnote
  50. .no1    lea    chan2(pc),a0
  51.     move.b    (a0)+,d0        ; test bn_on of channel 2
  52.     beq.s    .no2
  53.     moveq    #2,d4
  54.     bsr.s    _playnote
  55. .no2    lea    chan3(pc),a0
  56.     move.b    (a0)+,d0        ; test bn_on of channel 3
  57.     beq.s    .no3
  58.     moveq    #3,d4
  59.     bsr.s    _playnote
  60. .no3
  61.  
  62.     
  63. .exit    movem.l    (sp)+,d0-d7/a0-a6
  64.     ori.w    #%100,ccr    ; set Z flag
  65.     rts
  66.  
  67.  
  68. ; bang one channel
  69. ; a0=ptr to bangnote struct + 1
  70. _playnote
  71.     moveq    #0,d1
  72.     move.b    (a0),d1        ; d1=note
  73.     clr.b    (a0)+        ; reset note after one play
  74.  
  75.     moveq    #0,d3
  76.     move.b    (a0),d3        ; d3=ins
  77.     clr.b    (a0)+        ; reset instrument after one play
  78.  
  79.     moveq    #0,d2
  80.     move.b    (a0)+,d2    ; d2=fx
  81.  
  82.     moveq    #0,d0
  83.     move.b    (a0)+,d0    ; d0=fxval
  84.  
  85.     lea    THX(pc),a1
  86.  
  87.     ifd    USE020        ; include appropriate bang routine
  88.     incbin    bin/thx-bang020.bin
  89.     else
  90.     incbin    bin/thx-bang000.bin
  91.     endc
  92.